﻿package mortal.game.proxy
{
    import Framework.Util.*;
    import Message.Game.*;
    import Message.Public.*;
    import mortal.common.error.*;
    import mortal.game.manager.*;
    import mortal.game.manager.msgTip.*;
    import mortal.game.mvc.*;
    import mortal.mvc.core.*;

    public class RankingProxy extends Proxy
    {
        private var _entityId:SEntityId;
        private var _actionType:int;

        public function RankingProxy()
        {
            return;
        }// end function

        public function getToplist(param1:int, param2:int = 0) : void
        {
            rmi.iRankingPrx.getToplist_async(new AMI_IToplist_getToplist(this.getListSucc, null, param1), param2, param1);
            return;
        }// end function

        private function getListSucc(param1:AMI_IToplist_getToplist, param2:Array, param3:int) : void
        {
            var _loc_4:Object = {};
            _loc_4["rankingList"] = param2;
            _loc_4["serverId"] = param3;
            _loc_4["toplistType"] = param1.userObject;
            NetDispatcher.dispatchCmd(ServerCommand.RankingGetRankListSucc, _loc_4);
            return;
        }// end function

        public function getPraiseAndTrash(param1:SEntityId) : void
        {
            rmi.iRankingPrx.getPraiseAndTrash_async(new AMI_IToplist_getPraiseAndTrash(this.getPraiseSucc), param1);
            return;
        }// end function

        private function getPraiseSucc(param1:AMI_IToplist_getPraiseAndTrash, param2:int, param3:int) : void
        {
            var _loc_4:Object = {};
            _loc_4["praise"] = param2;
            _loc_4["trash"] = param3;
            NetDispatcher.dispatchCmd(ServerCommand.RankingGetPraiseAndTrash, _loc_4);
            return;
        }// end function

        public function kickPraise(param1:SEntityId, param2:int) : void
        {
            this._entityId = param1;
            this._actionType = param2;
            rmi.iRankingPrx.kickPraise_async(new AMI_IToplist_kickPraise(this.kickPraiseSucc, this.kickPraiseFail), param1, param2);
            return;
        }// end function

        private function kickPraiseSucc(param1:AMI_IToplist_kickPraise, param2:Boolean) : void
        {
            if (param2)
            {
                NetDispatcher.dispatchCmd(ServerCommand.RankingkickPraiseSucc, this._actionType);
                this.getPraiseAndTrash(this._entityId);
            }
            return;
        }// end function

        private function kickPraiseFail(param1:Exception) : void
        {
            MsgManager.showMouseMsg(ErrorCode.getErrorStringByCode(param1.code), MsgRollTipsType.msgRollTips3);
            return;
        }// end function

    }
}
